class Report {
  constructor(id, user_id, type, data, generated_at, period_start, period_end) {
    this.id = id;
    this.user_id = user_id;
    this.type = type;
    this.data = data;
    this.generated_at = generated_at;
    this.period_start = period_start;
    this.period_end = period_end;
  }

  // Convert to plain object for JSON serialization
  toJSON() {
    return {
      id: this.id,
      user_id: this.user_id,
      type: this.type,
      data: this.data,
      generated_at: this.generated_at,
      period_start: this.period_start,
      period_end: this.period_end
    };
  }

  // Create a Report instance from a database row
  static fromRow(row) {
    return new Report(
      row.id,
      row.user_id,
      row.type,
      row.data,
      row.generated_at,
      row.period_start,
      row.period_end
    );
  }
}

module.exports = Report;